
package org.come.Frame;

import com.tool.tcpimg.UIUtils;
import org.come.Jpanel.ChooseLiangHaoTypeJpanel;
import org.come.until.FormsManagement;
import org.come.until.MessagrFlagUntil;
import org.come.until.Music;

import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class ChooseLiangHaoTypeJframe extends JInternalFrame implements MouseListener {
    private ChooseLiangHaoTypeJpanel chooseLiangHaoTypeJpanel = new ChooseLiangHaoTypeJpanel();
    private int first_x;
    private int first_y;

    public static ChooseLiangHaoTypeJframe getChooseLiangHaoTypeJframe() {
        return (ChooseLiangHaoTypeJframe) FormsManagement.getInternalForm(638).getFrame();
    }

    public ChooseLiangHaoTypeJframe() {
        this.getContentPane().add(this.chooseLiangHaoTypeJpanel);
        this.setBorder(BorderFactory.createEmptyBorder());
        ((BasicInternalFrameUI) this.getUI()).setNorthPane((JComponent) null);
        this.setBounds(100, 50, 230, 320);
        this.setBackground(UIUtils.Color_BACK);
        this.pack();
        this.setVisible(false);
        this.setDefaultCloseOperation(3);
        this.addMouseListener(this);
        this.addMouseMotionListener(new MouseMotionListener() {
            public void mouseMoved(MouseEvent e) {
                if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE13)) {
                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
                }
            }

            public void mouseDragged(MouseEvent e) {
                if (ChooseLiangHaoTypeJframe.this.isVisible()) {
                    int x = e.getX() - ChooseLiangHaoTypeJframe.this.first_x;
                    int y = e.getY() - ChooseLiangHaoTypeJframe.this.first_y;
                    ChooseLiangHaoTypeJframe.this.setBounds(x + ChooseLiangHaoTypeJframe.this.getX(), y + ChooseLiangHaoTypeJframe.this.getY(), ChooseLiangHaoTypeJframe.this.getWidth(), ChooseLiangHaoTypeJframe.this.getHeight());
                }

            }
        });
    }

    public void mouseClicked(MouseEvent e) {
    }

    public void mousePressed(MouseEvent e) {
        Music.addyinxiao("关闭窗口.mp3");
        if (e.isMetaDown()) {
            FormsManagement.HideForm(638);
        } else {
            FormsManagement.Switchinglevel(638);
        }

        this.first_x = e.getX();
        this.first_y = e.getY();
    }

    public void mouseReleased(MouseEvent e) {
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }

    public ChooseLiangHaoTypeJpanel getChooseLiangHaoTypeJpanel() {
        return chooseLiangHaoTypeJpanel;
    }

    public void setChooseLiangHaoTypeJpanel(ChooseLiangHaoTypeJpanel chooseLiangHaoTypeJpanel) {
        this.chooseLiangHaoTypeJpanel = chooseLiangHaoTypeJpanel;
    }
}
